#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    timer = new QTimer(this);

    connect(timer, &QTimer::timeout, this, &MainWindow::handle);

    timer->start(10);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::handle()
{
    QString tmp = ui->label->text();
    int num = tmp.toInt() + 1;
    ui->label->setText(QString::number(num));

    if(num == 1000)
    {
        timer->stop();
    }
}

